package com.guigu.tms.oms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guigu.tms.commons.order.entity.OrderLocation;
import com.guigu.tms.oms.mapper.OrderLocationMapper;
import com.guigu.tms.oms.service.IOrderLocationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 订单位置信息  服务实现类
 * </p>
 *
 * @author zwj
 * @since 2022-09-27
 */
@Service
public class OrderLocationServiceImpl extends ServiceImpl<OrderLocationMapper, OrderLocation> implements IOrderLocationService {
    @Autowired
    private OrderLocationMapper orderLocationMapper;

    @Override
    public boolean addOrderLocation(OrderLocation orderLocation) {
        return orderLocationMapper.insert(orderLocation)>0;
    }

    @Override
    public OrderLocation getOrderLocationByOrderId(String orderId) {
        QueryWrapper<OrderLocation> wrapper=new QueryWrapper<>();
        wrapper.eq("order_id",orderId);
        return orderLocationMapper.selectOne(wrapper);
    }

}
